home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / etc / init.d / hotkey-setup < prev    next >
Encoding:
Text File  |  2007-04-11  |  2.4 KB  |  133 lines

  1. #!/bin/bash
  2.  
  3. manufacturer=`dmidecode --string system-manufacturer`
  4. name=`dmidecode --string system-product-name`
  5. version=`dmidecode --string system-version`
  6.  
  7. SAVED_STATE=/var/run/hotkey-setup
  8. THINKPAD_LOCKFILE=$SAVED_STATE.thinkpad-keys
  9.  
  10. # This is here because it needs to be executed both if we have a
  11. # Lenovo that also IDs as a ThinkPad, or if we have a real IBM one.
  12. do_thinkpad () {
  13.     . /usr/share/hotkey-setup/ibm.hk
  14.     if [ -x /usr/sbin/thinkpad-keys ]; then
  15.     if [ ! -c /dev/input/uinput ]; then
  16.         modprobe uinput
  17.     fi
  18.     if [ ! -c /dev/nvram ]; then
  19.         modprobe nvram
  20.     fi
  21.     /usr/sbin/thinkpad-keys && touch $THINKPAD_LOCKFILE
  22.     fi
  23. }
  24.  
  25. case "$1" in
  26.     start)
  27.  
  28.     /usr/sbin/dumpkeycodes >$SAVED_STATE
  29.     
  30.     if [ $? -gt 0 ]; then
  31.     rm -f $SAVED_STATE
  32.     fi
  33.  
  34.     . /usr/share/hotkey-setup/key-constants
  35.  
  36.     case "$manufacturer" in
  37.     Acer*)
  38.     . /usr/share/hotkey-setup/acer.hk
  39.     case "$name" in
  40.         Aspire\ 16*)
  41.         . /usr/share/hotkey-setup/acer-aspire-1600.hk
  42.         ;;
  43.     esac
  44.     ;;
  45.  
  46.     ASUS*)
  47.     . /usr/share/hotkey-setup/asus.hk
  48.     ;;
  49.  
  50.     Compaq*)
  51.     case "$name" in
  52.         Armada*E500*|Evo*N620*)
  53.         . /usr/share/hotkey-setup/compaq.hk
  54.         ;;
  55.     esac
  56.     ;;
  57.  
  58.     Dell*)
  59.     . /usr/share/hotkey-setup/dell.hk
  60.     ;;
  61.  
  62.     Hewlett-Packard*)
  63.     # Load this _first_, so that it can be overridden
  64.     . /usr/share/hotkey-setup/hp.hk
  65.     case "$name" in
  66.         # Please open a bug if uncommenting these "Presario" entries works for you...
  67.         #*Presario\ V2000*)
  68.         #. /usr/share/hotkey-setup/hp-v2000.hk
  69.         #;;
  70.         *Tablet*)
  71.         . /usr/share/hotkey-setup/hp-tablet.hk
  72.         ;;
  73.     esac
  74.     ;;
  75.  
  76.     IBM*)
  77.     do_thinkpad
  78.     ;;
  79.  
  80.     LENOVO*)
  81.     case "$version" in
  82.         *ThinkPad*)
  83.         do_thinkpad
  84.         ;;
  85.         *)
  86.         . /usr/share/hotkey-setup/lenovo.hk
  87.         ;;
  88.     esac
  89.     ;;
  90.     
  91.     MEDION*)
  92.     case "$name" in
  93.         *FID2060*)
  94.         . /usr/share/hotkey-setup/medion-md6200.hk
  95.         ;;
  96.     esac
  97.     ;;
  98.  
  99.     MICRO-STAR*)
  100.     case "$name" in
  101.         *INFINITY*)
  102.         . /usr/share/hotkey-setup/micro-star-infinity.hk
  103.         ;;
  104.     esac
  105.     ;;
  106.  
  107.     Samsung*|SAMSUNG*)
  108.     . /usr/share/hotkey-setup/samsung.hk
  109.     ;;
  110.  
  111.     Sony*)
  112.     modprobe sonypi; # Needed to get hotkey events
  113.     ;;
  114.  
  115.     *)
  116.     . /usr/share/hotkey-setup/default.hk    
  117.     esac
  118.     . /usr/share/hotkey-setup/generic.hk
  119.     ;;
  120.     stop)
  121.     if [ -f $THINKPAD_LOCKFILE ]; then
  122.         kill `pidof thinkpad-keys` && rm -f $THINKPAD_LOCKFILE || true
  123.     fi
  124.     if [ -f $SAVED_STATE ]; then
  125.         setkeycodes $(cat $SAVED_STATE) || true
  126.     fi
  127.     ;;
  128.     restart|force-reload)
  129.     $0 stop || true
  130.     $0 start
  131.     ;;
  132. esac
  133.